class Solution:
    def reverseBits(self, n: int) -> int:
        # 法一
        n = bin(n)[2:].zfill(32)
        res = 0
        for i in range(len(n)):
            if n[i] == '1':
                res += pow(2, i)
        return res
        # 法二
        # return int(bin(n)[2:].zfill(32)[::-1], 2)
        # 法三
        # for _ in range(32):
        #     res = (res << 1) | (n & 1)
        #     n >>= 1
        # return res
if __name__ == '__main__':
    s = Solution()
    print(s.reverseBits(43261596))